/*
* Copyright (C) 2024 ~ 2025 Uniontech Technology Co., Ltd.
*
* Author:      zhangbingyi <zhangbingyi@uniontech.com>
*
* Maintainer:  zhangbingyi <zhangbingyi@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPERATIONDELEGATE_H
#define OPERATIONDELEGATE_H

#include "devcommon_global.h"
#include "virusfiledetaildelegate.h"
#include "suggestdelegate.h"
#include "cominfo.h"

class DEVCOMMONSHARED_EXPORT OperationDelegate : public SuggestDelegate
{
    Q_OBJECT
public:
    explicit OperationDelegate(QObject *parent = nullptr);

    virtual void paint(QPainter *painter,
                       const QStyleOptionViewItem &option,
                       const QModelIndex &index) const override;

    virtual bool editorEvent(QEvent *event, QAbstractItemModel *model,
                             const QStyleOptionViewItem &option, const QModelIndex &index) override;

    virtual QWidget *createEditor(QWidget *parent,
                                  const QStyleOptionViewItem &option,
                                  const QModelIndex &index) const override;

    virtual bool helpEvent(QHelpEvent *event, QAbstractItemView *view,
                           const QStyleOptionViewItem &option, const QModelIndex &index) override;

Q_SIGNALS:
    // 修改第二列显示信息
    void suggestStatusChanged(int row, int status);

    //点击当前行信号
    void singleRowOperation(QString filePath, Itemtype type);

    //显示spinner信号
    void openPresistenEditor(const QModelIndex &index);

private:
    bool m_isLightTheme;
    QPoint m_mousePoint;
    QRect m_repairRect;
    QRect m_isolationRect;
    QRect m_trustRect;
};

#endif // OPERATIONDELEGATE_H
